package com.acegear.horizon.domain.repository.jpa;

import com.acegear.horizon.domain.models.jpa.ClubBase;

import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.query.Param;

import java.util.List;
import java.util.Optional;

/**
 * Created by wangsike on 2016/12/20.
 */
public interface ClubBaseRepository extends PagingAndSortingRepository<ClubBase, Long> {
    Optional<ClubBase> findByClubId(Long clubId);

    @Query("select cb from ClubBase cb where cb.clubId in :ids")
    List<ClubBase> findByClubIds(@Param("ids") List<Long> ids);

    List<ClubBase> findByRegister(boolean register, Pageable pageable);

    List<ClubBase> findAll();

    List<ClubBase> findByClubIdOrClubNameLike(Long clubId,String clubName);
}
